package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.TtsCameraInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.ITtsCameraInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 摄像头信息Controller
 *
 * @author li
 * @date 2025-08-18
 */
@Api(tags = "天童寺摄像头信息数据")
@RestController
@RequestMapping("/system/info")
public class TtsCameraInfoController extends BaseController
{
    @Autowired
    private ITtsCameraInfoService ttsCameraInfoService;

    /**
     * 查询摄像头信息列表
     */
    @GetMapping("/list")
    @ApiOperation("查询摄像头信息列表")
    public AjaxResult list(TtsCameraInfo ttsCameraInfo)
    {
        List<TtsCameraInfo> list = ttsCameraInfoService.selectTtsCameraInfoList(ttsCameraInfo);
        return success(list);
    }

    /**
     * 导出摄像头信息列表
     */
    @Log(title = "摄像头信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TtsCameraInfo ttsCameraInfo)
    {
        List<TtsCameraInfo> list = ttsCameraInfoService.selectTtsCameraInfoList(ttsCameraInfo);
        ExcelUtil<TtsCameraInfo> util = new ExcelUtil<TtsCameraInfo>(TtsCameraInfo.class);
        util.exportExcel(response, list, "摄像头信息数据");
    }

    /**
     * 获取摄像头信息详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ttsCameraInfoService.selectTtsCameraInfoById(id));
    }

    /**
     * 新增摄像头信息
     */
    @Log(title = "摄像头信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TtsCameraInfo ttsCameraInfo)
    {
        return toAjax(ttsCameraInfoService.insertTtsCameraInfo(ttsCameraInfo));
    }

    /**
     * 修改摄像头信息
     */
    @Log(title = "摄像头信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TtsCameraInfo ttsCameraInfo)
    {
        return toAjax(ttsCameraInfoService.updateTtsCameraInfo(ttsCameraInfo));
    }

    /**
     * 删除摄像头信息
     */
    @Log(title = "摄像头信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ttsCameraInfoService.deleteTtsCameraInfoByIds(ids));
    }
}
